<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui" 
	xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:s="http://myfaces.apache.org/sandbox">

<head>
</head>
<body>

	<ui:composition template="../WEB-INF/layout/template.xhtml">
		<ui:define name="title"><h:outputText value="#{msg.add_school}" /></ui:define>
		<ui:define name="content">
		
			<p:growl id="growl"/>
			<p:messages/>	
					
			<h:form id="schoolForm">
		
				<h:panelGrid columns="1">
					<p:panel id="generalitiesPanel" header="#{msg.generalities}">							
						<h:panelGrid columns="5">
							<h:panelGroup>
								#{msg.provider_code}<br/>
								<p:inputText id="providerCodeInputText" value="#{inserisciScuolaBean.schoolInput.providerCode}" required="false"/><br/>
								<p:message for="providerCodeInputText"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.national_provider}<br/>
								<p:inputText id="nationalProviderInputText" value="#{inserisciScuolaBean.schoolInput.nationalProvider}" required="false"/><br/>
								<p:message for="nationalProviderInputText"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.code}<br/>
								<p:inputText id="codeInputText" value="#{inserisciScuolaBean.schoolInput.code}" required="true"/><br/>
								<p:message for="codeInputText"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.school_name}<br/>
								<p:inputText id="nameInputText" value="#{inserisciScuolaBean.schoolInput.ragioneSociale}" required="true"/><br/>
								<p:message for="nameInputText"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.web_address}<br/>
								<p:inputText id="webInputText" value="#{inserisciScuolaBean.schoolInput.webSite}" size="25" required="false">
									<f:validator for="webInputText" validatorId="urlValidator"/>
								</p:inputText><br/>
								<p:message for="webInputText"/>
							</h:panelGroup>
						</h:panelGrid>
						<h:panelGrid columns="6">
							<h:panelGroup>
								#{msg.address_line_1}<br/>
								<p:inputText id="addr1InputText" value="#{inserisciScuolaBean.schoolInput.indirizzo.indirizzoLinea1}" required="true"/><br/>
								<p:message for="addr1InputText"/>
							</h:panelGroup>
	<!--						<h:panelGroup>-->
	<!--							#{msg.address_line_2}<br/>-->
	<!--							<p:inputText id="addr2InputText" value="#{inserisciScuolaBean.schoolInput.indirizzo.indirizzoLinea2}" required="false"/>-->
	<!--						</h:panelGroup>-->
							<h:panelGroup>
								#{msg.town}<br/>
								<p:autoComplete id="townInputText" 
									value="#{inserisciScuolaBean.schoolInput.indirizzo.citta}" 
									required="true" 
									completeMethod="#{inserisciScuolaBean.completeTownAu}"/>
								<p:message for="townInputText"/>  
							</h:panelGroup>
							<h:panelGroup>
								#{msg.state}<br/>
								<h:selectOneMenu id="stateInputText" value="#{inserisciScuolaBean.schoolInput.indirizzo.stato}">
									<f:selectItems value="#{inserisciScuolaBean.stateOptions}"/>
								</h:selectOneMenu>
								<p:message for="stateInputText"/>  
							</h:panelGroup>
							<h:panelGroup>
								#{msg.post_code}<br/>
								<p:inputText id="postCodeInputText" value="#{inserisciScuolaBean.schoolInput.indirizzo.postCode}" required="true" size="6"/><br/>
								<p:message for="postCodeInputText"/>  
							</h:panelGroup>
							<h:panelGroup>
								#{msg.country}<br/>
								<p:inputText id="countryInputText" value="#{inserisciScuolaBean.schoolInput.indirizzo.paese}" required="true"/><br/>
								<p:message for="countryInputText"/>
							</h:panelGroup>
						</h:panelGrid>
						<h:panelGrid columns="4">
							<h:panelGroup>
								#{msg.cricos_code}<br/>
								<p:inputText id="cricosInputText" value="#{inserisciScuolaBean.schoolInput.cricosProviderCode}" required="false"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.elicos_code}<br/>
								<p:inputText id="elicosInputText" value="#{inserisciScuolaBean.schoolInput.elicosCode}" required="false"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.abn}<br/>
								<p:inputText id="abnInputText" value="#{inserisciScuolaBean.schoolInput.abn}" required="false"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.ongoing_contract}<br/>
								<h:selectBooleanCheckbox value="#{inserisciScuolaBean.schoolInput.contrattoInCorso}" >
								</h:selectBooleanCheckbox>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.bsb}<br/>
								<p:inputMask value="#{inserisciScuolaBean.schoolInput.bsb}" mask="999 999"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.bank_name}<br/>
								<p:autoComplete value="#{inserisciScuolaBean.schoolInputBankName}" 
									completeMethod="#{inserisciScuolaBean.completeBankName}"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.account_number}<br/>
								<p:inputText id="bankAccountNumber" value="#{inserisciScuolaBean.schoolInput.bankAccountNumber}"/><br/>
								<p:message for="bankAccountNumber"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.spift_code}<br/>
								<p:inputText id="bankSpiftCode" value="#{inserisciScuolaBean.schoolInput.spiftCode}"/><br/>
								<p:message for="bankSpiftCode"/>
							</h:panelGroup>
						</h:panelGrid>
						
						<h:outputText value="#{msg.bank_account_holder}" /><br/>
						<h:panelGrid columns="3">
							<h:panelGroup>
								#{msg.first_name}<br/>
								<p:inputText id="holderFirstName" value="#{inserisciScuolaBean.schoolInput.intestatarioContoFirstName}"/><br/>
								<p:message for="holderFirstName"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.middle_name}<br/>
								<p:inputText id="holderMiddleName" value="#{inserisciScuolaBean.schoolInput.intestatarioContoMiddleName}"/><br/>
								<p:message for="holderMiddleName"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.surname}<br/>
								<p:inputText id="holderSurname" value="#{inserisciScuolaBean.schoolInput.intestatarioContoSurname}"/><br/>
								<p:message for="holderSurname"/>
							</h:panelGroup>
						</h:panelGrid>
						<h:panelGrid columns="2">
							<h:panelGroup>
								#{msg.bank}<br/>
								<h:selectOneMenu id="bankSOM" value="#{inserisciScuolaBean.schoolInput.bank}" converter="bancaStringConverter" hideNoSelectionOption="false">
<!--									<f:selectItems -->
<!--										value="#{inserisciScuolaBean.banks}" -->
<!--										var="bank" -->
<!--										itemValue="#{bank}" -->
<!--										itemLabel="#{bank.name}"/>-->
									<f:selectItems value="#{inserisciScuolaBean.banksOptions}"/>
									<p:ajax update="bankBranchSOM"/>
								</h:selectOneMenu>
								<p:commandButton value="#{msg.new}" onclick="bankDlg.show()" process="@this"/>
							</h:panelGroup>
							<h:panelGroup>
								#{msg.bank_branch}<br/>
								<h:selectOneMenu id="bankBranchSOM" value="#{inserisciScuolaBean.schoolInput.bankBranch}" converter="bankBranchStringConverter"
									disabled="#{empty inserisciScuolaBean.schoolInput.bank}">
<!--									<f:selectItems -->
<!--										value="#{inserisciScuolaBean.bankBranches}" -->
<!--										var="branch" -->
<!--										itemValue="#{branch}" -->
<!--										itemLabel="#{branch.indirizzo.indirizzoLinea1}, #{branch.indirizzo.citta}"/>-->
									<f:selectItems value="#{inserisciScuolaBean.bankBranchesOptions}"/>
								</h:selectOneMenu>
								<p:commandButton value="#{msg.new}" onclick="bankBranchDlg.show()" process="@this"/>
							</h:panelGroup>
						</h:panelGrid>
					</p:panel>
			
					<p:panel id="contactsPanel" header="#{msg.contacts}">					
						<h:panelGrid columns="2">
							<p:dataTable value="#{inserisciScuolaBean.schoolInput.contattiDiRiferimento}" var="contact">
								<p:column>
									<f:facet name="header">
										#{msg.first_name}
									</f:facet>
									<p:inputText id="contactFirstName" value="#{contact.firstName}" size="8" required="true" >
										<p:ajax event="keyup" update="schoolForm:branches"/>
									</p:inputText><br/>
									<p:message for="contactFirstName"/>
								</p:column>
	<!--							<p:column>-->
	<!--								<f:facet name="header">-->
	<!--									<h:outputText value="#{msg.middle_name}"/>-->
	<!--								</f:facet>-->
	<!--								<p:inputText id="contactMiddleName" value="#{contact.middleName}" size="8" required="false" >-->
	<!--									<p:ajax event="keyup" update="schoolForm:branches"/>-->
	<!--								</p:inputText>-->
	<!--							</p:column>-->
								<p:column>
									<f:facet name="header">
										#{msg.surname}
									</f:facet>
									<p:inputText id="contactSurname" value="#{contact.surname}" size="8" required="true" >
										<p:ajax event="keyup" update="schoolForm:branches"/>
									</p:inputText><br/>
									<p:message for="contactSurname"/>
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.role}
									</f:facet>
									<p:inputText id="contactRole" value="#{contact.ruolo}" size="15" required="false" />
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.email}
									</f:facet>
									<p:inputText id="contactEmail" value="#{contact.email.email}" size="15" required="false" >
										<f:validator for="contactEmail" validatorId="emailValidator"/>
									</p:inputText><br/>
									<p:message for="contactEmail"/>
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.work_phone}
									</f:facet>
									<p:inputText id="contactWorkPhone" value="#{contact.workPhone.number}" size="10" required="false" />
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.mobile_phone}
									</f:facet>
									<p:inputText id="contactMobilePhone" value="#{contact.mobilePhone.number}" size="10" required="false" />
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.notes}
									</f:facet>
									<p:inputText id="contactNote" value="#{contact.note}" required="false" />
								</p:column>
								<p:column>
									<p:commandButton value="X" action="#{inserisciScuolaBean.schoolInput.removeContact}" process="@this" update="schoolForm growl">
										<f:setPropertyActionListener target="#{inserisciScuolaBean.schoolInput.contactToRemove}" value="#{contact}" />
									</p:commandButton>
								</p:column>
							</p:dataTable>
							<p:commandButton 
								ajax="true" 
								value="+" 
								actionListener="#{inserisciScuolaBean.addSchoolInputContact}" 
								update="schoolForm growl"/>
						</h:panelGrid>
					</p:panel>
				
					<p:panel id="branchesPanel" header="#{msg.branches}">	
						<h:panelGrid columns="2">
							<p:dataTable id="branches" value="#{inserisciScuolaBean.schoolInput.branches}" var="branch">
								<p:column>
									<f:facet name="header">
										#{msg.address_line_1}
									</f:facet>
									<p:inputText id="branchAddr1" value="#{branch.indirizzo.indirizzoLinea1}" size="15" required="true"/><br></br>
									<p:message for="branchAddr1"/>
								</p:column>
	<!--							<p:column>-->
	<!--								<f:facet name="header">-->
	<!--									#{msg.address_line_2}-->
	<!--								</f:facet>-->
	<!--								<p:inputText id="branchAddr2" value="#{branch.indirizzo.indirizzoLinea2}" size="15" required="false"/>-->
	<!--							</p:column>-->
								<p:column>
									<f:facet name="header">
										#{msg.town}
									</f:facet>
									<p:autoComplete 
										id="branchTown" 
										value="#{branch.indirizzo.citta}" 
										size="10" 
										required="false" 
										completeMethod="#{inserisciScuolaBean.completeTownAu}">
										<p:ajax event="keyup" update="schoolForm:courses"/>
									</p:autoComplete>
									<p:message for="branchTown"/>
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.state}
									</f:facet>
									<h:selectOneMenu value="#{branch.indirizzo.stato}">
										<f:selectItems value="#{inserisciScuolaBean.stateOptions}"/>
									</h:selectOneMenu>
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.post_code}
									</f:facet>
									<p:inputText 
										id="branchPostCode" 
										value="#{branch.indirizzo.postCode}" 
										size="4" 
										required="true" 
										validator="postCodeValidator"/><br/>
									<p:message for="branchPostCode"/>
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.work_phone}
									</f:facet>
									<p:inputText id="branchPhone" value="#{branch.telephone.number}" size="10" required="false"/>
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.contact_person}
									</f:facet>
									<h:selectOneMenu id="branchContactSOM" value="#{branch.contact}" converter="contattoScuolaStringConverter">
										<f:selectItems 
											value="#{inserisciScuolaBean.schoolInput.contattiDiRiferimento}" 
											var="contact" 
											itemValue="#{contact}" 
											itemLabel="#{contact.firstName} #{contact.middleName} #{contact.surname}"/>
									</h:selectOneMenu>
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.notes}
									</f:facet>
									<p:inputText id="branchNotes" value="#{branch.note}" required="false"/>
								</p:column>
								<p:column>
									<p:commandButton value="X" action="#{inserisciScuolaBean.schoolInput.removeBranch}" process="@this" update="schoolForm growl">
										<f:setPropertyActionListener target="#{inserisciScuolaBean.schoolInput.branchToRemove}" value="#{branch}" />
									</p:commandButton>
								</p:column>
							</p:dataTable>
							<p:commandButton 
								value="+" 
								actionListener="#{inserisciScuolaBean.addSchoolInputBranch}" 
								update="schoolForm growl"/>
						</h:panelGrid>
					</p:panel>
				
					<p:panel id="coursesPanel" header="#{msg.courses} #{inserisciScuolaBean.schoolInput.numCourses}">	
						<h:panelGrid columns="2">
							<p:dataTable id="courses" value="#{inserisciScuolaBean.schoolInput.courses}" var="course" >
								<p:column style="width:16px">  
									<p:rowToggler />  
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.code}
									</f:facet>
									<p:inputText id="courseCode" value="#{course.code}" size="6" required="false"/>
								</p:column>
								<p:column sortBy="#{course.categoria.macroCategoria.name}">
									<f:facet name="header">
										#{msg.category}
									</f:facet>
									<h:selectOneMenu id="courseCategorySOM" converter="courseCategoryConverter"
										value="#{course.categoria}">
										<f:selectItems 
											value="#{inserisciScuolaBean.courseCategories}" 
											var="category" 
											itemLabel="#{category.name}" 
											itemValue="#{category}"/>
										<p:ajax/>
									</h:selectOneMenu>
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.name}
									</f:facet>
									<p:inputText id="courseName" value="#{course.name}" size="12" required="true"/><br/>
									<p:message for="courseName"/>
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.description}
									</f:facet>
									<p:inputText id="courseDescription" value="#{course.description}" required="false"/>
								</p:column>
								<p:column style="width:200%">
									<f:facet name="header">
										#{msg.branches}  
									</f:facet>
									<h:selectManyListbox id="courseBranchesSMC" 
										value="#{course.sedi}" 
										converter="sedeStringConverter" 
										layout="pageDirection" 
										layoutWidth="1">
										<f:selectItems 
											value="#{inserisciScuolaBean.schoolInput.branches}" 
											var="branch" 
											itemLabel="#{branch.indirizzo.citta}" 
											itemValue="#{branch}"/>
										<p:ajax event="click"/>
									</h:selectManyListbox>
								</p:column>
								<p:column>
									<f:facet name="header">
										#{msg.notes}
									</f:facet>
									<p:inputText id="courseNotes" value="#{course.note}" required="false"/>
								</p:column>
								<p:column>
									<p:commandButton value="X" action="#{inserisciScuolaBean.schoolInput.removeCourse}" process="@this" update="schoolForm growl">
										<f:setPropertyActionListener target="#{inserisciScuolaBean.schoolInput.courseToRemove}" value="#{course}" />
									</p:commandButton>
								</p:column>
								<p:rowExpansion id="rowExpansion">
									<h:panelGrid columns="2" style="border-style:hidden;">
										<h:panelGrid columns="2" style="border-style:hidden;">
											<f:facet name="header">
												#{msg.subscription_commission}
											</f:facet>
											<h:selectOneRadio style="border-style:hidden;" value="#{course.subscriptionCommission.type}" layout="pageDirection">
												<f:selectItem itemLabel="#{msg.percentage}" itemValue="true"/>
												<f:selectItem itemLabel="#{msg.fixed}" itemValue="false"/>
												<p:ajax update="subpercamount"/>
											</h:selectOneRadio>
											<h:panelGroup id="subpercamount">
												<h:inputText value="#{course.subscriptionCommission.percentage}" disabled="#{not course.subscriptionCommission.type}" size="3">
													<f:convertNumber maxFractionDigits="2" minIntegerDigits="1"/>
													<f:ajax event="keyup"/>
												</h:inputText>%<br/>
												<h:inputText value="#{course.subscriptionCommission.amount}" disabled="#{course.subscriptionCommission.type}" size="3">
													<f:convertNumber maxFractionDigits="2" minIntegerDigits="1"/>
													<f:ajax event="keyup"/>
												</h:inputText>$
											</h:panelGroup>
										</h:panelGrid>
										<h:panelGrid columns="2" style="border-style:hidden;">
											<f:facet name="header">
												#{msg.tuition_fee_commission}
											</f:facet>
											<h:selectOneRadio style="border-style:hidden;" value="#{course.tuitionCommission.type}" layout="pageDirection">
												<f:selectItem itemLabel="#{msg.percentage}" itemValue="true"/>
												<f:selectItem itemLabel="#{msg.fixed}" itemValue="false"/>
												<p:ajax update="tuipercamount"/>
											</h:selectOneRadio>
											<h:panelGroup id="tuipercamount">
												<h:inputText value="#{course.tuitionCommission.percentage}" disabled="#{not course.tuitionCommission.type}" size="3">
													<f:convertNumber maxFractionDigits="2" minIntegerDigits="1"/>
													<p:ajax event="keyup"/>
												</h:inputText>%<br/>
												<h:inputText value="#{course.tuitionCommission.amount}" disabled="#{course.tuitionCommission.type}" size="3">
													<f:convertNumber maxFractionDigits="2" minIntegerDigits="1"/>
													<f:ajax event="keyup"/>
												</h:inputText>$
											</h:panelGroup>
										</h:panelGrid>
									</h:panelGrid>
									<h:panelGrid columns="2" style="border-style:hidden;">
										<p:dataTable id="costs" value="#{course.costi}" var="cost" >
											<p:column>
												<f:facet name="header">
													#{msg.subscription_fee}
												</f:facet>
												<p:inputText id="subscriptionFee" value="#{cost.subscriptionFee}" size="6"/>
											</p:column>
											<p:column>
												<f:facet name="header">
													#{msg.from}
												</f:facet>
												<!-- p:spinner id="minWeeks" value="#{cost.minWeeks}" min="1" max="9999" size="3" required="false"/> -->
												<h:selectOneMenu id="minWeeks" value="#{cost.minWeeks}">
													<f:selectItems value="#{inserisciScuolaBean.numWeeksOptions}"/>
												</h:selectOneMenu>
											</p:column>
											<p:column>
												<f:facet name="header">
													#{msg.to}
												</f:facet>
												<!-- p:spinner id="maxWeeks" value="#{cost.maxWeeks}" min="1" max="9999" size="3" required="false"/> -->
												<h:selectOneMenu id="maxWeeks" value="#{cost.maxWeeks}">
													<f:selectItems value="#{inserisciScuolaBean.numWeeksOptions}"/>
												</h:selectOneMenu>
											</p:column>
											<p:column>
												<f:facet name="header">
													#{msg.AB_weekly_price}
												</f:facet>
												$<p:inputText id="ab_weeklyPrice" value="#{cost.weeklyPrice}" size="6" required="false"/>
											</p:column>
											<p:column>
												<f:facet name="header">
													#{msg.public_weekly_price}
												</f:facet>
												$<p:inputText id="publicWeeklyPrice" value="#{cost.weeklyPricePublic}" size="6" required="false"/>
											</p:column>
											<p:column>
												<p:commandButton value="X" action="#{course.removeCost}" process="@this" update="costs growl">
													<f:setPropertyActionListener target="#{course.costToRemove}" value="#{cost}" />
												</p:commandButton>
											</p:column>
										</p:dataTable>
										<p:commandButton value="+" action="#{course.addEmptyCost}" update="costs growl"/>
									</h:panelGrid>
								</p:rowExpansion>
							</p:dataTable>
							<p:commandButton value="+" action="#{inserisciScuolaBean.addSchoolInputCourse}" update="schoolForm growl"/>
						</h:panelGrid>
					</p:panel>
				
					<p:commandButton value="#{msg.submit}" action="#{inserisciScuolaBean.submit}" update="schoolForm growl"/>
				</h:panelGrid>				
			</h:form>
			
			
			<p:dialog id="bankDialog" 
					modal="true" 
					header="#{msg.new_bank}" 
					widgetVar="bankDlg" 
					onHide="document.forms['bankForm'].reset();">
				<h:form id="bankForm">
					<h:outputLabel value="#{msg.name}" for="bankName"/>
					<p:inputText id="bankName" value="#{inserisciScuolaBean.bankInput.name}">
						<f:validator for="bankName" validatorId="newBankNameValidator"/>
					</p:inputText>
					<p:message for="bankName"/><br/>
					<p:commandButton 
						value="#{msg.submit}" 
						action="#{inserisciScuolaBean.submitBank}" 
						update="schoolForm growl bankBranchForm"
						oncomplete="handleBankDialogRequest(xhr, status, args)"/>
				</h:form>
			</p:dialog>
			
			<p:dialog id="bankBranchDialog" 
					modal="true" 
					header="#{msg.new_branch} #{msg.for}: #{inserisciScuolaBean.schoolInput.bank}" 
					widgetVar="bankBranchDlg" 
					onHide="document.forms['bankBranchForm'].reset();">
				<h:form id="bankBranchForm">
					<h:panelGrid columns="3">
						<h:outputLabel value="#{msg.address_line_1}" for="addr1"/>
						<p:inputText id="addr1" value="#{inserisciScuolaBean.bankBranchInput.indirizzo.indirizzoLinea1}" required="true"/>
						<p:message for="addr1"/>
						<h:outputLabel value="#{msg.town}" for="town"/>
						<p:inputText id="town" value="#{inserisciScuolaBean.bankBranchInput.indirizzo.citta}" required="true"/>
						<p:message for="town"/>
						<h:outputLabel value="#{msg.country}" for="country"/>
						<p:inputText id="country" value="#{inserisciScuolaBean.bankBranchInput.indirizzo.paese}" required="true"/>
						<p:message for="country"/>
					</h:panelGrid>
					<p:commandButton 
						value="#{msg.submit}" 
						action="#{inserisciScuolaBean.submitBankBranch}" 
						update="schoolForm growl"
						oncomplete="handleBankBranchDialogRequest(xhr, status, args)"/>
				</h:form>
			</p:dialog>
			
			<script type="text/javascript">
				function handleBankDialogRequest(xhr, status, args) {
					if(args.validationFailed) {
						jQuery('#bankDialog').effect("shake", { times:3 }, 100);
					} else {
						bankDlg.hide();
						document.forms['bankForm'].reset();			
					}
				}
				function handleBankBranchDialogRequest(xhr, status, args) {
					if(args.validationFailed) {
						jQuery('#bankBranchDialog').effect("shake", { times:3 }, 100);
					} else {
						bankBranchDlg.hide();
						document.forms['bankBranchForm'].reset();			
					}
				}
			</script>
			
		</ui:define>
	</ui:composition>

</body>
</html>
